<template>
	<view class="bgc">
		<view class="" style="background-color:#648ADD ;width: 100%;height: 250rpx;display:flex;align-items: center;">
			<u-avatar :src="list.imagePath" shape shape="square" style="margin-left:130rpx;"></u-avatar>
			<view class="" style="margin-left:50rpx;">{{list.userName}}</view>
		</view>
		<view class="">
			<u-cell-group>
				<u-cell icon="share" title="个人资料" :isLink=true url="/pages/studentpage/geren"></u-cell>
			</u-cell-group>
			<u-cell-group>
				<u-cell icon="share" title="个人动态" :isLink=true url="/pages/studentpage/dongtai"></u-cell>
			</u-cell-group>
			<u-cell-group>
				<u-cell icon="share" title="消息" :isLink=true url="/pages/studentpage/geren"
					style="margin-bottom: 10rpx;"></u-cell>
			</u-cell-group>
			<u-cell-group>
				<u-cell icon="share" title="设置" :isLink=true url="/pages/studentpage/geren"></u-cell>
			</u-cell-group>
			<u-cell-group>
				<u-cell icon="share" title="反馈" :isLink=true url="/pages/studentpage/geren"></u-cell>
			</u-cell-group>
			<u-cell-group>
				<u-cell icon="share" title="关于" style="margin-bottom: 10rpx;" :isLink=true
					url="/pages/studentpage/geren"></u-cell>
			</u-cell-group>
			<u-cell-group>
				<u-cell icon="share" title="退出账号" @click="fn"></u-cell>
			</u-cell-group>
		</view>
	</view>
</template>

<script>
	import http from '../../http.js'
	export default {
		data() {
			return {
				list: {
					id: "",
					userUuid: "",
					userName: "", //用户名
					realName: "", //真实姓名
					age: "", //年龄
					role: "", //角色
					sex: "", //性别
					birthDay: "", //生日
					phone: "", //手机号
					lastActiveTime: "",
					createTime: "",
					modifyTime: "",
					status: 1, //状态
					userLevel: "", //年级
					classes: "", //用户班级
					imagePath: "" //用户头像
				},
			}
		},
		methods: {
			getList() {
				http({
					url: '/api/student/user/current',
					method: 'POST'
				}).then(res => {
					// console.log(res);
					if (res.code === 1) {
						this.list = res.response
					}
				})
			},
			
			fn() {
				http({
					url: '/api/user/logout',
					method: 'POST' // 明确请求方法，根据接口要求调整
				}).then(res => {
					console.log( res);
					if (res.code === 1) {
						uni.redirectTo({
							url: '/pages/studentpage/login' 
						});
					}
				})
			}
		},
		onLoad() {
			this.getList()
		},
	}
</script>

<style lang="scss">
	* {
		margin: 0;
		padding: 0;
	}

	.bgc {
		height: 100%;
		background-color: #F7F7F7;
	}
</style>